home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
iaca101.zip
/
IACATALK.DOC
< prev
next >
Wrap
Text File
|
1992-02-04
|
6KB
|
128 lines
IACATALK version 1.01 Feb 4, 1992
"Talking" between CONFIG.SYS and AUTOEXEC.BAT through the
Inter-Application Communications Area
by Robert W. Babcock
(BIX: rbabcock Internet: peprbv@cfaamp.harvard.edu
BITNET: babcock@cfa or babcock@cfa.harvard.edu)
WSS Division of DDC
4 Reeves Road
Bedford, MA 01730
USA
617-275-1183
I have about 10 different system configurations, each with its own CONFIG.SYS
and AUTOEXEC.BAT, and I reconfigure by copying the appropriate files into the
root directory and rebooting. The problem is, the AUTOEXEC files aren't very
different, and I often find myself editing all of them to install the same
change. What I really wanted was a way for AUTOEXEC.BAT to make decisions
based on which CONFIG.SYS file was loaded so that I could use a single AUTOEXEC
file. DOS doesn't provide any obvious way of doing this, but I have found a
reasonably portable way.
There are 16 bytes at address 40:f0 called the Inter-Application Communications
Area (IACA). These can safely be modified by any program, but according to
Dave Williams DOSREF, the only applications which actually use them are the
Time Mark program included with some versions of the Norton Utilities, Turbo
Power's FMARK and the BRIEF editor. I have written a device driver which
sticks a string into the IACA, then exits without using any memory. A
companion program reads the string out of the IACA and assigns it to an
environment variable in the master environment. This can be one of the first
things done in AUTOEXEC.BAT, so there is little danger of the IACA being
overwritten before it is read.
IACAFILL.SYS is the device driver. In CONFIG.SYS, include a line
DEVICE=[path]IACAFILL.SYS string
where string is the characters to be saved. If more than 16 characters are
found, the excess will be ignored. Blanks are not allowed (a blank ends the
string as far as IACAFILL is concerned) and DOS may convert the string to
upper case. (DOS 5 does this; I haven't tested other DOS versions.)
Interestingly, Quarterdeck's DEVICE.COM which loads a device driver in a
DesqView window does not force the arguments to upper case. IACAFILL does not
remain resident, so there is no point in loading it high. It is also smaller
than one 512 byte disk sector, so there is no point in beating on the code to
try and make it smaller.
IACAREAD.EXE is the program which reads the saved string. Include a line in
AUTOEXEC.BAT
IACAREAD variable_name
where variable_name is the name of the environment variable to be set.
IACAREAD has the same effect as the DOS command
SET variable_name=string
The environment variable can be referred to in a BAT file as %variable_name%.
To avoid syntax errors if the SET has failed for some reason, it is best to
prepend some character and test the combined string as is done in the example
below. If IACAREAD fails, it probably means that there was not enough
environment space left to add the string. IACAREAD is relatively large, even
after being processed by an executable shrinker such as PKLite, LZEXE or DIET
because it includes C library routines. Anyone want to rewrite it in assembler?
Usage example:
CONFIG.SYS
DEVICE=c:\DOS\DRIVERS\IACAFILL.SYS GCC
AUTOEXEC.BAT
IACAREAD SYSTYPE
if NOT /%SYSTYPE% == /GCC goto skipgcc
rem only set all this stuff if using GCC
set gccbin=d:/gpp/bin
set gccinc=d:/gpp/include
set gcclib=d:/gpp/lib
set gcctmp=h:/
set go32=ansi driver d:/gpp/drivers/ati.grd gw 1024 gh 768
set bison_simple=d:/gpp/lib/bison.simple
set bison_hairy=d:/gpp/lib/bison.hairy
set flex_skeleton=d:/gpp/lib/flex.skeleton
:skipgcc
...
Debugging
If the expected environment variable doesn't get set, the first thing to do is
to use DEBUG to examine the IACA using the command
D 40:f0 L 16
In particular, make sure that the string has the expected case. (You might
also do this before putting IACAFILL.SYS into CONFIG.SYS on a machine which
is not fully IBM compatible. If all 16 bytes are not zero, IACAFILL is likely
to fail or cause something else to fail.) The other thing to check is whether
you have enough environment space. I use Quarterdeck's Manifest to do this,
but I'm sure there are many alternatives.
Credits
The code for manipulating the master environment was written by John Lowenthal
(BIX: jlowenthal) and donated by OPENetwork to the public domain. The routine
for finding the master environment traces back to a message posted on BIX by
P. Maupin.
Distribution terms and disclaimer
IACAFILL and the main program for IACAREAD are copyright 1991 by R. W. Babcock
and WSS Division of DDC. Source code is included in the package and is freely
distributable. Unlimited noncommercial use of this code is authorized. Since
I'm not asking any for money, I also disclaim any responsibility for anything
this software may do. It works for me, and I'll probably attempt to fix any
bugs that are reported. The most likely way you could get in trouble is by
adding the device driver to CONFIG.SYS on your hard disk, then finding out that
it interacts with something else in your configuration and crashes on boot.
Either test it first from a bootable floppy, or make sure that a bootable
floppy is available before you fiddle with CONFIG.SYS. (You really should
have such a floppy in any case.)
Revision history
Nov. 11, 1991 - initial 1.0 beta release
Feb 4, 1992 - 1.01 final release. Only changes are minor documentation
corrections and removal of "beta" designation. SYS and EXE files are
unchanged. Also note with this release that the Dec. 17, 1991 PC Magazine
Languages column has a pair of programs which share information through the
IACA.